
* Open log
capture log close
log using "Data analysis\cbld-management05.log", replace text


* ************************************
* Empirically observed consensus rates
* ************************************

* Programme:	cbld-management05.do
* Project:		Council coalition building
* Author:		Frank Haege, Department of Politics and Administration, University of Limerick
* Contact:		frank.haege@ul.ie

* Description
*************
* This do-file inputs data on consensual decision-making in the Council and 
* saves them in different data set formats.
* The data for the years 1994 up to and including 2002 are directly taken 
* from Table 1a in Heisenberg (2005: 72); the data for the years 2003 to 2006 
* are calculated from Table 3 in Hagemann & De Clerck-Sachsse (2007: 13).


* Set up Stata
version 11
clear all
macro drop _all
set linesize 80
set more off

	
* Input observed consensus rate data and generate figure
********************************************************	
	
* Input consensus data
input year consensus nostates
	1994 75 12
	1995 78 15
	1996 81 15
	1997 78 15
	1998 74 15
	1999 85 15
	2000 97 15
	2001 83 15
	2002 81 15
	2003 78 15
	2004 91 15
	2005 89 25
	2006 78 25
end
	
* Generate rule-member state period variable
generate rulemembersize = .
replace rulemembersize = 1 if year == 1994
replace rulemembersize = 2 if year > 1994 & year <= 2003
replace rulemembersize = 3 if year > 2003 & year <= 2006
replace rulemembersize = 4 if year > 2006	

* Label variables	
label var year "Year"
label var consensus "Consensual Decisions (%)"	
label var nostates "Number of Member States"
label var rulemembersize "Rule-membership period"
	
* Save consensus data in long format
sort rulemembersize
compress
save "Experiments\Other data\cbld-management05a.dta", replace	
		
* Reshape consensus data into wide format
forvalues i = 1994(1)2006 {
	generate consensus`i' = consensus if year == `i'
}

* Collapse data by number of member states
collapse (mean) mconsensus = consensus (min) consensus* , by(rulemembersize)	
drop consensus

* Label variables
label var mconsensus "Observed consensus (mean)"
forvalues i = 1994(1)2006 {
	label var consensus`i' "Observed consensus (`i')"
}

* Adjust regime variable slightly for plotting of predicted values in Figure 4
preserve
	replace rulemembersize = rulemembersize - 0.2
	drop mconsensus
	save "Experiments\Other data\cbld-management05b.dta", replace	
restore
preserve
	replace rulemembersize = rulemembersize - 0.1
	drop consensus*
	save "Experiments\Other data\cbld-management05c.dta", replace	
restore

* Save consensus data in wide format
sort rulemembersize
save "Experiments\Other data\cbld-management05d.dta", replace


* Exit do-file
log close
exit
